<pre>
<?php if(!empty($result) && !empty($result['extended'])): ?>
    <?php 
                    $extended = json_decode($result['extended'],true);
                    if($result['type'] ==OptionLog::OPTION_TYPE_ADD) {
                        if (!empty($extended['new'])) {
                            foreach ($extended['new'] as $key => $value) {
                                echo '<span>'.$key.'</span>:'.$value.'</br>';
                            }
                        }
                    }
                    if($result['type'] ==OptionLog::OPTION_TYPE_UPDATE) {
                        if (!empty($extended['old'])) {
                            echo '旧数据:</br>';
                            foreach ($extended['old'] as $key => $value) {
                                if ($value != $extended['new'][$key]) {
                                    echo '<span style="color:#f00">'.$key.'</span>:'.$value.'</br>';
                                } else {
                                    echo '<span>'.$key.'</span>:'.$value.'</br>';
                                }
                            }
                        }
                        if (!empty($extended['new'])) {
                            echo '</br>修改后数据:</br>';
                            foreach ($extended['new'] as $key => $value) {
                                if ($value != $extended['old'][$key]) {
                                    echo '<span>'.$key.'</span>:'.$value.'</br>';

                                }
                            }
                        }
                    }
                    if($result['type'] ==OptionLog::OPTION_TYPE_DELETED) {
                        if (!empty($extended)) {
                            foreach ($extended as $key => $value) {
                                echo '<span>'.$key.'</span>:'.$value.'</br>';
                            }
                        }
                    }
                ?>
<?php endif; ?>
</pre>